var Page = Page || {};
Page.Utility = Page.Utility || {};
Page.Utility.Registration = Page.Utility.Registration || {};
// 获取密码强度
Page.Utility.Registration.getPasswordLevel = function(password) {
	if (password == null || password == '')
		return 0;
	if (password.length <= 4)
		return 0; // 密码太短
	var Modes = 0;
	for (i = 0; i < password.length; i++) {
		Modes |= CharMode(password.charCodeAt(i));
	}
	return bitTotal(Modes);
	// CharMode函数
	function CharMode(iN) {
		if (iN >= 48 && iN <= 57) // 数字
			return 1;
		if (iN >= 65 && iN <= 90) // 大写字母
			return 2;
		if (iN >= 97 && iN <= 122) // 小写
			return 4;
		else
			return 8; // 特殊字符
	}
	// bitTotal函数
	function bitTotal(num) {
		modes = 0;
		for (i = 0; i < 4; i++) {
			if (num & 1)
				modes++;
			num >>>= 1;
		}
		return modes;
	}
};